<template>
  <view class="page">
    <my-modal ref="modal" title="温馨提示" :button="[{ text: '点击重新登录', type: 'gold', plain: false }]" @clickModal="clickModal()" @clickBtn="clickBtn">
      <view class="container fs-xs">您当前的登录状态已过期，需要授权重新登录。否则将无法完成后续操作</view>
    </my-modal>

    <my-loading ref="loading"></my-loading>
  </view>
</template>

<script>
export default {
  data() {
    return {}
  },
  onLoad() {},
  onShow() {
    this.$refs.modal.open({ showClose: false })
  },
  methods: {
    clickModal() {
      this.$msg('text', '点击重新登录即可继续操作啦～')
    },
    clickBtn() {
      this.$refs.loading.open()
      this.login()
        .then(res => {
          this.$eventHub.$emit('login', res)
          uni.navigateBack()
        })
        .catch(err => {
          this.errMsg(err, '登录失败 请重试')
        })
        .finally(() => {
          this.$refs.loading.close()
        })
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped></style>
